package com.jstyle.jclife.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.haibin.calendarview.CalendarLayout;


/**
 * 如果嵌套各种View出现事件冲突，可以实现这个方法即可
 */
public class CalendarLinearLayout extends LinearLayout implements CalendarLayout.CalendarScrollView {

    RecyclerView RecyclerViewRank;

    public CalendarLinearLayout(Context context) {
        super(context);
    }

    public CalendarLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    public boolean isScrollToTop() {
        if(RecyclerViewRank==null){
            if (getChildCount() > 1 && getChildAt(1) instanceof RecyclerView) {
                RecyclerViewRank= (RecyclerView) getChildAt(1);
            }
        }
        return RecyclerViewRank != null && RecyclerViewRank.computeVerticalScrollOffset() == 0;
    }
}
